// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

using System;

namespace SnapObjects.Data
{
    /// <summary>
    ///     Represents an object that contains the data of a model object and the state of the data. 
    ///     It provides methods, properties, and events for accessing and manipulating the data and state.
    /// </summary>
    public interface IModelEntry
    {
        /// <summary>
        ///     Occurs when the current value is changed.
        /// </summary>
        event Action<string, object> CurrentValueChanged;

        /// <summary>
        ///     Gets the tracked state of the data.
        /// </summary>
        ModelState ModelState { get; }

        /// <summary>
        ///     Gets the property names of the model class.
        /// </summary>
        string[] Properties { get; }

        /// <summary>
        ///     Gets the tracked state of the specified property.
        /// </summary>
        /// <param name="name">The name of the property.</param>
        /// <returns>The tracked state of the specified property.</returns>
        PropertyState GetPropertyState(string name);

        /// <summary>
        ///     Gets the original value of the specified property.
        /// </summary>
        /// <param name="name">The name of the property.</param>
        /// <returns>The original value of the specified property.</returns>
        object GetOriginalValue(string name);

        /// <summary>
        ///     Gets the current value of the specified property.
        /// </summary>
        /// <param name="name">The name of the property.</param>
        /// <returns>The current value of the specified property.</returns>
        object GetCurrentValue(string name);

        /// <summary>
        ///     Sets the current value for the specified property.
        /// </summary>
        /// <param name="name">The name of the property.</param>
        /// <param name="value">The value set to the specified property.</param>
        void SetCurrentValue(string name, object value);
    }

    /// <summary>
    ///     Represents an object that contains the data of the TModel object and the state of the data. 
    ///     It provides methods, properties, and events for accessing and manipulating the data and state.
    /// </summary>
    /// <typeparam name="TModel"></typeparam>
    public interface IModelEntry<TModel> : IModelEntry
    {
    }
}
